package com.fxcomponents.mp3player
{
	public class PlayButton extends Button
	{
		public function PlayButton()
		{
			super();
		}
		
		public static const PLAY:uint = 0;
		public static const PAUSE:uint = 1;
		
		private var _iconShape:uint = PLAY;
		
		public function set iconShape(value:uint):void
		{
			_iconShape = value;
			invalidateDisplayList();
		}
		
		public function get iconShape():uint
		{
			return _iconShape;
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			
			icon.graphics.clear();
			icon.graphics.beginFill(0);
			
			var x:uint, y:uint, w:int, h:int;
			
			if(_iconShape == PLAY)
			{
				x = 0;
				y = 0;
				w = 1;
				h = 7;
				
				for(; h>0; h -= 2)
					icon.graphics.drawRect(x++, y++, w, h);
			}
			
			if(_iconShape == PAUSE)
			{
				icon.graphics.drawRect(0, 0, 2, 7);
				icon.graphics.drawRect(3, 0, 2, 7);
			}
				
			centerIcon();
		}
	}
}